mudbox::TexturePool Class Reference

#include <material.h>

Inheritance diagram for mudbox::TexturePool:

Inheritance graph
[legend]
List of all members.

Detailed Description

This is a container class for simple textures.

In Mudbox, textures are confined to a 0 to 1 UV space. If an object has texture coordinates that go outside this 0-1 space, then multiple texture tiles are used to represent the texture, one tile per unit region in texture space. This class is a container for all the tiles that comprise a texture.

Mudbox also uses paint layers (where each layer would have the same number of tiles). An instance of the TexturePool class can therefore also be a LayerContainer. In this case it is possible to cast a TexturePool pointer into a pointer to a LayerContainer instance, and use the LayerContainer pointer to determine the number of layers and get them. Each pointer to a layer object can then be cast into a TexturePool object again, which then will be the physical paint layer. See the Material class documentation for more details.


Public Types

enum   RenderMode { renderModeConstantColor, renderModeTexture, renderModeVertexColor }
enum   Location { locationUnknown, locationGPU, locationCPU, locationDisk }

Public Member Functions

virtual const mudbox::ClassDesc RuntimeClass (void) const
virtual QString  Name (void) const
  Returns the name of the texturepool.
virtual void  SetName (const QString &sName)
  Sets the name of the texture pool.
virtual unsigned int  RenderMode (void) const
  Returns the render mode of the texture pool. 0=constant color, 1=texture, 2=vertex color.
virtual void  SetRenderMode (unsigned int iMode)
  Sets the render mode for the texture pool.
virtual void  SetLocation (unsigned int iLocation)
  Sets the location for the texture pool.
virtual unsigned int  Location (void)
  Gets the location for the texture pool.
virtual TexturePool operator= (TexturePool &cT)
virtual int  Width (void) const
  Returns the number of tiles in a row.
virtual void  SetWidth (int iWidth)
  Sets the number of tiles in a row.
virtual void  SetFileName (const QString &sFileName)
  Set the file name mask for the texture pool.
virtual const QString &  FileName (void) const
  Returns the file name mask for the texture pool. The name may contain tile wildcards (i, x, y).
virtual void  Save (const QString &sFileName="", const QString &sFormat="", Material *m=NULL)
  Saves the textures into files on the disk.
virtual void  SetDirty (bool bDirty)
  Sets the dirty status of the texture.
virtual bool  IsDirty (void)
  Gets the dirty status of the texture.
virtual void  AddToDirtyArea (const Vector &cPoint)
  Adds a point to the dirty region of this texture pool.
virtual void  Reload (void)
  Reload the pool from the files based on the current file name mask.
virtual void  SetContentChanged (void)
  Sets a flag to say that the texturepool has been modified.
virtual bool  IsContentChanged (void)
  Returns true if the texturepool has been modified since the last file save.
virtual unsigned int  TileCount (void) const
  Returns the number of created tiles so far. These tiles can overlap.
virtual class Texture Tile (unsigned int iTileIndex)
  Returns a pointer to a specified tile. Do not delete this pointer.
virtual class Texture Tile (const AxisAlignedBoundingBox &cTCArea, bool bAlloc=true)
  Returns a texture tile for a coordinate range. Attempts to create the texture if it does not yet exist.
virtual AxisAlignedBoundingBox  TileArea (unsigned int iTileIndex) const
  Returns the UV area associated with a tile.
virtual TextureMixer Mixer (void) const
  Returns a mixed object for the pool.
virtual int  BlendMode (void) const
  Returns the blending mode of the pool.
virtual void  SetBlendMode (int iMode)
  Sets the blending mode.
virtual void  SetMaterial (Material *pMaterial)
virtual Material GetMaterial () const

Static Public Member Functions

const mudbox::ClassDesc StaticClass (void)
mudbox::Node CreateInstances (unsigned int iCount=1)

Protected Member Functions

  TexturePool (void)
  Constructor. Do not use it directly; Use CreateInstance() instead.

Member Enumeration Documentation

enum mudbox::TexturePool::RenderMode
 
Enumeration values:
renderModeConstantColor 
renderModeTexture 
renderModeVertexColor 
00284     {
00285         renderModeConstantColor,
00286         renderModeTexture,
00287         renderModeVertexColor
00288     };
enum mudbox::TexturePool::Location
 
Enumeration values:
locationUnknown 
locationGPU 
locationCPU 
locationDisk 
00291     {
00292         locationUnknown,
00293         locationGPU,
00294         locationCPU,
00295         locationDisk
00296     };

Constructor & Destructor Documentation

mudbox::TexturePool::TexturePool void   )  [protected]
 

Constructor. Do not use it directly; Use CreateInstance() instead.

            TexturePool *myTexturePool = CreateInstance<TexturePool>();

Member Function Documentation

virtual const mudbox::ClassDesc* mudbox::TexturePool::RuntimeClass void   )  const [inline, virtual]
 

Reimplemented from mudbox::Node.

00273 :
const mudbox::ClassDesc* mudbox::TexturePool::StaticClass void   )  [static]
 

Reimplemented from mudbox::Node.

mudbox::Node* mudbox::TexturePool::CreateInstances unsigned int  iCount = 1  )  [static]
 

Reimplemented from mudbox::Node.

virtual QString mudbox::TexturePool::Name void   )  const [virtual]
 

Returns the name of the texturepool.

virtual void mudbox::TexturePool::SetName const QString &  sName  )  [virtual]
 

Sets the name of the texture pool.

Parameters:
sName  [in] New texture pool name. If the texture pool is a layer, this is the name of the layer seen in the UI.

Reimplemented from mudbox::Node.

virtual unsigned int mudbox::TexturePool::RenderMode void   )  const [virtual]
 

Returns the render mode of the texture pool. 0=constant color, 1=texture, 2=vertex color.

virtual void mudbox::TexturePool::SetRenderMode unsigned int  iMode  )  [virtual]
 

Sets the render mode for the texture pool.

virtual void mudbox::TexturePool::SetLocation unsigned int  iLocation  )  [virtual]
 

Sets the location for the texture pool.

virtual unsigned int mudbox::TexturePool::Location void   )  [virtual]
 

Gets the location for the texture pool.

virtual TexturePool& mudbox::TexturePool::operator= TexturePool cT  )  [virtual]
 
virtual int mudbox::TexturePool::Width void   )  const [virtual]
 

Returns the number of tiles in a row.

The number of tiles in a TexturePool depends on the texture coordinates of the meshes which are using the pool. If the mesh has texture coordinates only within the 0-1 range, then only a single tile will be used, so this function will return 1. But for example when the U texture coordinate is in the range of 0-3 and V is in the range of 0-2, then six tiles will be used, this function will return 3 (since there are 3 tiles horizontally)

virtual void mudbox::TexturePool::SetWidth int  iWidth  )  [virtual]
 

Sets the number of tiles in a row.

virtual void mudbox::TexturePool::SetFileName const QString &  sFileName  )  [virtual]
 

Set the file name mask for the texture pool.

If there is more than a single tile used in the pool, then the file name will be extended with a string indicating which tile it belongs to. The attached string has the format _uX_vY, where X is the horizontal, and Y is the vertical coordinate of the tile. For example if the given filename is texture.jpg, then the name for the third tile in the first row will be texutre_u3_v1.jpg

Parameters:
sFileName  [in] The base file name for the texture files in this pool
virtual const QString& mudbox::TexturePool::FileName void   )  const [virtual]
 

Returns the file name mask for the texture pool. The name may contain tile wildcards (i, x, y).

virtual void mudbox::TexturePool::Save const QString &  sFileName = "",
const QString &  sFormat = "",
Material m = NULL
[virtual]
 

Saves the textures into files on the disk.

If the file format is PSD and the material is not null, the uv mesh is drawn in a layer above the image layer saved by this function.

Parameters:
sFileName  [in] The file name to save
sFormat  [in] The file format in the form "bitDepth,dataType", i.e. "8,i" for 8bit/channel integer. 8,16,32 are valid for bitdepth and i and fp are valid for dataType.
m  [in] The material assciated with this texture pool.
virtual void mudbox::TexturePool::SetDirty bool  bDirty  )  [virtual]
 

Sets the dirty status of the texture.

This function must be called after the texture content is changed

Parameters:
bDirty  [in] Set to true to mark the texture dirty.
virtual bool mudbox::TexturePool::IsDirty void   )  [virtual]
 

Gets the dirty status of the texture.

virtual void mudbox::TexturePool::AddToDirtyArea const Vector cPoint  )  [virtual]
 

Adds a point to the dirty region of this texture pool.

Parameters:
cPoint  [in] the area of the texture pool to mark as dirty
virtual void mudbox::TexturePool::Reload void   )  [virtual]
 

Reload the pool from the files based on the current file name mask.

virtual void mudbox::TexturePool::SetContentChanged void   )  [virtual]
 

Sets a flag to say that the texturepool has been modified.

virtual bool mudbox::TexturePool::IsContentChanged void   )  [virtual]
 

Returns true if the texturepool has been modified since the last file save.

virtual unsigned int mudbox::TexturePool::TileCount void   )  const [virtual]
 

Returns the number of created tiles so far. These tiles can overlap.

virtual class Texture* mudbox::TexturePool::Tile unsigned int  iTileIndex  )  [virtual]
 

Returns a pointer to a specified tile. Do not delete this pointer.

Parameters:
iTileIndex  [in] Index of the tile to be returned
virtual class Texture* mudbox::TexturePool::Tile const AxisAlignedBoundingBox cTCArea,
bool  bAlloc = true
[virtual]
 

Returns a texture tile for a coordinate range. Attempts to create the texture if it does not yet exist.

Parameters:
cTCArea  [in] The UV area that corresponds to the desired texture.
bAlloc  [in] Set this to true to guarantee the returned Texture is loaded onto the GPU.
virtual AxisAlignedBoundingBox mudbox::TexturePool::TileArea unsigned int  iTileIndex  )  const [virtual]
 

Returns the UV area associated with a tile.

Parameters:
iTileIndex  [in] Index of the tile
virtual TextureMixer* mudbox::TexturePool::Mixer void   )  const [virtual]
 

Returns a mixed object for the pool.

virtual int mudbox::TexturePool::BlendMode void   )  const [virtual]
 

Returns the blending mode of the pool.

virtual void mudbox::TexturePool::SetBlendMode int  iMode  )  [virtual]
 

Sets the blending mode.

Parameters:
iMode  [in] The index of the desired blending mode (see TextureMixer::BlendModeCount() and TextureMixer::BlendModeName() )
virtual void mudbox::TexturePool::SetMaterial Material pMaterial  )  [virtual]
 
Parameters:
pMaterial  [in] Set the material associated with this TexturePool.
virtual Material* mudbox::TexturePool::GetMaterial  )  const [virtual]
 

mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool
mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool mudbox::TexturePool